﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Diagnostics;

namespace StarfleetCommanderDomain.Game
{
    [DebuggerDisplay("\\{ Name = {Name}, Level = {Level} \\}")]
    public sealed class Tech : IEquatable<Tech>
    {
        private readonly string _name;
        private readonly byte _level;

        public Tech(string name, byte level)
        {
            _name = name;
            _level = level;
        }

        public override bool Equals(object obj)
        {
            if (obj is Tech)
                return Equals((Tech)obj);
            return false;
        }
        public bool Equals(Tech obj)
        {
            if (obj == null)
                return false;
            if (!EqualityComparer<string>.Default.Equals(_name, obj._name))
                return false;
            if (!EqualityComparer<byte>.Default.Equals(_level, obj._level))
                return false;
            return true;
        }
        public override int GetHashCode()
        {
            int hash = 0;
            hash ^= EqualityComparer<string>.Default.GetHashCode(_name);
            hash ^= EqualityComparer<byte>.Default.GetHashCode(_level);
            return hash;
        }
        public override string ToString()
        {
            return String.Format("{{ Value = {0}, Parse = {1} }}", _name, _level);
        }

        public string Name
        {
            get
            {
                return _name;
            }
        }
        public byte Level
        {
            get
            {
                return _level;
            }
        }
    }
}